package com.miniapp.enums;

/**
 * 存储类型枚举
 * 支持多种OSS实现的扩展
 *
 * @author yourName
 * @date 2025-09-05
 */
public enum StorageTypeEnum {
    /**
     * MinIO存储
     */
    MINIO("minio", "MinIO对象存储"),

    /**
     * 阿里云OSS
     */
    ALIYUN_OSS("aliyun", "阿里云OSS"),

    /**
     * 青云对象存储
     */
    QINGCLOUD_OSS("qingcloud", "青云对象存储");

    private final String code;
    private final String desc;

    StorageTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据编码获取枚举
     */
    public static StorageTypeEnum getByCode(String code) {
        for (StorageTypeEnum type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return null;
    }
}
